package org.simp.util.log;
/**
 *
 * @Author zhuhaitao at 2014年6月24日
 *
 *
 **/
public class LogSysOut implements Logger {

	private static final String info =" [INFO] ";
	private static final String debug = " [DEBUG] ";
	private static final String warn = " [WARN] ";
	private static final String error = " [ERROR] ";
	
	private Class clazz;
	private String tag ;
	public LogSysOut (){}
	public LogSysOut(Class clazz){
		this.clazz = clazz;
		tag = " ["+clazz.getSimpleName() +"] ";
	}
	
	@Override
	public void info(String message) {
		System.out.println(info + tag + message);
		
	}

	@Override
	public void debug(String message) {
		System.out.println(debug + tag+ message);
		
	}

	@Override
	public void debug(String message, Throwable t) {
		System.out.println( debug + tag + message + t.getMessage());
		t.printStackTrace();
		
	}

	@Override
	public void warn(String message, Throwable t) {
		System.out.println(warn + tag + message + t.getMessage());
		t.printStackTrace();
		
	}

	@Override
	public void warn(String message) {
		
		System.out.println(warn + tag + message);
	}

	@Override
	public void error(String message) {
		
		System.err.println(error + tag + message);
	}

	@Override
	public void error(String message, Throwable t) {
		System.err.println( error + tag + message + t.getMessage());
		t.printStackTrace();
		
	}

	@Override
	public Logger create(Class clazz) {
		
		return new LogSysOut(clazz);
	}

}
